#include <cstdio>

int ans[50][50];

int main() {
	ans[1][1] = 0;
	ans[1][2] = 1;
	ans[1][3] = 2;
	ans[1][4] = 2;
	ans[1][5] = 3;
	ans[1][6] = 4;
	ans[1][7] = 4;
	ans[1][8] = 5;
	ans[1][9] = 6;
	ans[1][10] = 6;
	ans[1][11] = 7;
	ans[1][12] = 8;
	ans[1][13] = 8;
	ans[1][14] = 9;
	ans[1][15] = 10;
	ans[1][16] = 10;
	ans[1][17] = 11;
	ans[1][18] = 12;
	ans[1][19] = 12;
	ans[1][20] = 13;
	ans[1][21] = 14;
	ans[1][22] = 14;
	ans[1][23] = 15;
	ans[1][24] = 16;
	ans[1][25] = 16;
	ans[1][26] = 17;
	ans[1][27] = 18;
	ans[1][28] = 18;
	ans[1][29] = 19;
	ans[1][30] = 20;
	ans[1][31] = 20;
	ans[1][32] = 21;
	ans[1][33] = 22;
	ans[1][34] = 22;
	ans[1][35] = 23;
	ans[1][36] = 24;
	ans[1][37] = 24;
	ans[1][38] = 25;
	ans[1][39] = 26;
	ans[1][40] = 26;
	ans[2][1] = 1;
	ans[2][2] = 2;
	ans[2][3] = 4;
	ans[2][4] = 5;
	ans[2][5] = 7;
	ans[2][6] = 8;
	ans[2][7] = 10;
	ans[2][8] = 11;
	ans[2][9] = 13;
	ans[2][10] = 14;
	ans[2][11] = 16;
	ans[2][12] = 17;
	ans[2][13] = 19;
	ans[2][14] = 20;
	ans[2][15] = 22;
	ans[2][16] = 23;
	ans[2][17] = 25;
	ans[2][18] = 26;
	ans[2][19] = 28;
	ans[2][20] = 29;
	ans[3][1] = 2;
	ans[3][2] = 4;
	ans[3][3] = 6;
	ans[3][4] = 8;
	ans[3][5] = 11;
	ans[3][6] = 13;
	ans[3][7] = 15;
	ans[3][8] = 17;
	ans[3][9] = 20;
	ans[3][10] = 22;
	ans[3][11] = 24;
	ans[3][12] = 26;
	ans[3][13] = 29;
	ans[4][1] = 2;
	ans[4][2] = 5;
	ans[4][3] = 8;
	ans[4][4] = 12;
	ans[4][5] = 14;
	ans[4][6] = 17;
	ans[4][7] = 21;
	ans[4][8] = 24;
	ans[4][9] = 26;
	ans[4][10] = 30;
	ans[5][1] = 3;
	ans[5][2] = 7;
	ans[5][3] = 11;
	ans[5][4] = 14;
	ans[5][5] = 18;
	ans[5][6] = 22;
	ans[5][7] = 26;
	ans[5][8] = 29;
	ans[6][1] = 4;
	ans[6][2] = 8;
	ans[6][3] = 13;
	ans[6][4] = 17;
	ans[6][5] = 22;
	ans[6][6] = 26;
	ans[7][1] = 4;
	ans[7][2] = 10;
	ans[7][3] = 15;
	ans[7][4] = 21;
	ans[7][5] = 26;
	ans[8][1] = 5;
	ans[8][2] = 11;
	ans[8][3] = 17;
	ans[8][4] = 24;
	ans[8][5] = 29;
	ans[9][1] = 6;
	ans[9][2] = 13;
	ans[9][3] = 20;
	ans[9][4] = 26;
	ans[10][1] = 6;
	ans[10][2] = 14;
	ans[10][3] = 22;
	ans[10][4] = 30;
	ans[11][1] = 7;
	ans[11][2] = 16;
	ans[11][3] = 24;
	ans[12][1] = 8;
	ans[12][2] = 17;
	ans[12][3] = 26;
	ans[13][1] = 8;
	ans[13][2] = 19;
	ans[13][3] = 29;
	ans[14][1] = 9;
	ans[14][2] = 20;
	ans[15][1] = 10;
	ans[15][2] = 22;
	ans[16][1] = 10;
	ans[16][2] = 23;
	ans[17][1] = 11;
	ans[17][2] = 25;
	ans[18][1] = 12;
	ans[18][2] = 26;
	ans[19][1] = 12;
	ans[19][2] = 28;
	ans[20][1] = 13;
	ans[20][2] = 29;
	ans[21][1] = 14;
	ans[22][1] = 14;
	ans[23][1] = 15;
	ans[24][1] = 16;
	ans[25][1] = 16;
	ans[26][1] = 17;
	ans[27][1] = 18;
	ans[28][1] = 18;
	ans[29][1] = 19;
	ans[30][1] = 20;
	ans[31][1] = 20;
	ans[32][1] = 21;
	ans[33][1] = 22;
	ans[34][1] = 22;
	ans[35][1] = 23;
	ans[36][1] = 24;
	ans[37][1] = 24;
	ans[38][1] = 25;
	ans[39][1] = 26;
	ans[40][1] = 26;

	int r, c;

	scanf("%d%d", &r, &c);
	printf("%d\n", ans[r][c]);

	return 0;
}
